﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

namespace B2B.Models
{
    public class SP_DangKy
    {
        string email;

        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        string password;

        public string Password
        {
            get { return password; }
            set { password = value; }
        }
        int maQG;

        public int MaQG
        {
            get { return maQG; }
            set { maQG = value; }
        }
        int maTinhBang;

        public int MaTinhBang
        {
            get { return maTinhBang; }
            set { maTinhBang = value; }
        }
        string hoTen;

        public string HoTen
        {
            get { return hoTen; }
            set { hoTen = value; }
        }
        int loaiTV;

        public int LoaiTV
        {
            get { return loaiTV; }
            set { loaiTV = value; }
        }
        string soDT;

        public string SoDT
        {
            get { return soDT; }
            set { soDT = value; }
        }
        string website;

        public string Website
        {
            get { return website; }
            set { website = value; }
        }
        string tenCOngTy;

        public string TenCOngTy
        {
            get { return tenCOngTy; }
            set { tenCOngTy = value; }
        }

        public static int DangKy(SP_DangKy dangky)
        {
            SqlConnection conn = KetNoi.Connection();
            SqlCommand cmd = new SqlCommand("SP_DANGKY", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@EMAIL", dangky.Email);
            cmd.Parameters.AddWithValue("@PASSWORD", dangky.Password);
            cmd.Parameters.AddWithValue("@MAQG", dangky.MaQG);
            cmd.Parameters.AddWithValue("@HOTEN", dangky.HoTen);
            cmd.Parameters.AddWithValue("@LOAITV", dangky.LoaiTV);
            cmd.Parameters.AddWithValue("@SODT", dangky.SoDT);
            cmd.Parameters.AddWithValue("@WEBSITE", dangky.Website);
            cmd.Parameters.AddWithValue("@TENCONGTY", dangky.TenCOngTy);
            conn.Open();
            int kq = cmd.ExecuteNonQuery();
            conn.Close();
            return kq;
        }
    }
}